define([
	'../libs/zepto',
	'../common/base',
	'../common/common_click',
	'../common/dialog',
	'../common/yingSoftPrg',
	'../common/yingSoftCookie',
	'../common/ajax'
],function(){
	var guid = G_Cookie.getGuid();
	var appID = G_Cookie.getAppID();
	getMaterialData(guid,appID);
	
	function getMaterialData(guid,appID) {
		var materialData = [];
		G_AjaxApiVideo_OSS.get('/api/knowledge/getBook?guid=' + guid + '&appID=' + appID, true, function(json) {
			var jsonData = JSON.parse(json);
			
			if(jsonData.status == 400 || jsonData.status == 300) {
				G_Prg.throw('程序运行错误！："' + jsonData.msg + '"！', function() {
					window.location.href = 'doExam-index';
				});
			} else if(jsonData.status == 200) {
				var list=jsonData.data.books;
				for(var i=0;i<jsonData.data.books.length;i++){
					var liList='<li BookID='+list[i].BookID+' SortID='+list[i].SortID+'><a href="#">'+list[i].BookName+'</a><span><img src="images/getInto.png" alt="" /></span></li>'
					$('.soft').append(liList);
					$('.soft li').on('click',function(){
						G_Prg.setCookie('BOOKID',$(this).attr('BookID'));
						window.location.href="/BasisChinese";
					})
				}
				$('.soft li').on('click',function(){
					G_Prg.setCookie('BookID',$(this).attr('BookID'));
					window.location.href="/BasisChinese";
				})
			} else if(jsonData.status == 201) {
				G_Prg.throw('考点精讲正在拼命筹备中，敬请期待!', function() {
					window.location.href = '/doExam-index';
				});
			} else {
				G_Prg.throw('程序运行错误！："无法处理"！', function() {
					window.location.href = '/doExam-index';
				});
			}
		});
	}
});

